package com.ruoyi.web.controller.manage;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.manage.domain.request.VerificationCodeRequest;
import com.ruoyi.manage.service.ISendSmsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: wwy
 * @Date: 2021/1/6 14:23
 */
@Api("门户端短信")
@RestController
@RequestMapping("/api")
public class SendSmsController {
    @Autowired
    private ISendSmsService sendSmsService;

    /**
     * 发送短信
     * @param verificationCodeRequest
     * @return
     */
    @ApiOperation("门户端发送注册验证码接口")
    @PostMapping("/sendVerificationCodeRegister")
    public AjaxResult sendVerificationCodeRegister(@RequestBody VerificationCodeRequest verificationCodeRequest){
        sendSmsService.sendVerificationCodeRegister(verificationCodeRequest);
        return AjaxResult.success();
    }

    /**
     * 发送短信
     * @param verificationCodeRequest
     * @return
     */
    @ApiOperation("门户端发送登录验证码接口")
    @PostMapping("/sendVerificationCodeLogin")
    public AjaxResult sendVerificationCodeLogin(@RequestBody VerificationCodeRequest verificationCodeRequest){
        sendSmsService.sendVerificationCodeLogin(verificationCodeRequest);
        return AjaxResult.success();
    }

    /**
     * 发送短信
     * @param verificationCodeRequest
     * @return
     */
    @ApiOperation("门户端发送修改密码验证码接口")
    @PostMapping("/sendVerificationCodeRetrieve")
    public AjaxResult sendVerificationCodeRetrieve(@RequestBody VerificationCodeRequest verificationCodeRequest){
        sendSmsService.sendVerificationCodeRetrieve(verificationCodeRequest);
        return AjaxResult.success();
    }
}
